<?php

// 前台md5加密
if(!function_exists("indexpassword")){
    function indexpwd($pwd){
        $code = "asdff213adsxcASD";

        return md5($pwd.$code);
    }
}

// 无线级输出分类
if(!function_exists("get_three_tree")){

    // 递归方法实现无线级分类柱状图
    function get_three_tree($arrs,$pid=0)
    {
        $tree = [];

        foreach($arrs as $v)
        {
            if($v['pid'] == $pid){

                $v['son'] = get_three_tree($arrs,$v['id']);

                $tree[] = $v;
            }
        }
        return $tree;

    }
    // 引用方式 实现 无线级分类柱状套
/*    function get_three_tree($arrs){
        $list = [];

        foreach($arrs as $v)
        {
            $list[$v['id']] = $v;
        }

        foreach($list as $k=>$v){
            $list[$v['pid']]['son'][$v['id']] = &$list[$v['id']];
        }

        return isset($list[0]['son']) ? $list[0]['son'] : 1;
    }*/
}